package main

import (
	"fmt"
)
type humen struct {
	add string
}
type student struct{
	ren humen
	name string
	age int
	sex string
}

type dog struct {

	name string
	color string
	age int
}
func main()  {
	p1:=student{}
	fmt.Println(&p1)

	p1.name="老王"
	p1.age=20
	p1.sex="男"
	fmt.Println(p1)
	p2:=&p1

	p2.name="黑黑"
	fmt.Println(p1,p2)

	var p3 student
	p3.name="hehe"
	p3.age=30
	p3.sex="女"
	fmt.Println(p3)
	fmt.Println(p3.name,p3.age,p3.sex)

	fmt.Printf("%T,%p\n",p1,&p1)
	fmt.Printf("%T,%p\n",p2,&p2)
	fmt.Printf("%T,%p\n",p3,&p3)

	//p4:=student{"男",30,"王二狗 "}
	//fmt.Println(p4)

	p5:=student{age:30,sex:"女",name:"rose"}
	fmt.Println(p5)

	p6:=student{
		name:"he",
		age:35,
		sex:"男",
	}
	fmt.Println(p6)
	p7:=new(student)
	fmt.Println(p7)
	p7.name="wang"
	p7.age=60
	p7.sex="人妖"
	fmt.Println(p7)

	fmt.Println("----------dog struce---------")
	d1:=dog{
		"小天",
		"red",
		3,
	}
	d2:=d1
	fmt.Println(d2)
	fmt.Printf("%p %p",&d1,&d2)

	d2.name="xiaoxiao"
	fmt.Println(d1,d2)

	d3:=new(dog)
	fmt.Println(d3)
	d3.name="hehe"
	d3.color="yellow"
	d3.age=4
	d4:=d3
	d4.age=6
	fmt.Println(d1,d3,d4)

	d6:=&d1
	d6.name="aaa"
	fmt.Println(d1,d6)

}
